package com.bwie.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @description : 商品ES对象
 * @Author QiHainan
 * @Create 2025/3/28 19:52
 * @Version 1.0
 */
@Data
@Document(indexName = "es_prod",shards = 1,replicas = 0)
public class EsProd implements Serializable {
    /**
     * 商品ID
     */
    @Id
    @Field(type = FieldType.Keyword)
    private Integer prodId;

    /**
     * 商品名称
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String prodName;

    /**
     * 商品类型
     */
    @Field(type = FieldType.Integer)
    private Integer prodType;

    /**
     * 商品价格
     */
    @Field(type = FieldType.Double)
    private BigDecimal prodPrice;

    /**
     * 库存
     */
    @Field(type = FieldType.Integer)
    private Integer prodStock;

    /**
     * 商品状态：0草稿1待审核2上线3驳回4下线
     */
    @Field(type = FieldType.Integer)
    private Integer prodStatus;

    /**
     * 商家id
     */
    @Field(type = FieldType.Integer)
    private Integer userId;

    /**
     * 录入时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8",shape  = JsonFormat.Shape.STRING)
    @Field(pattern = "yyyy-MM-dd HH:mm:ss", type = FieldType.Date, format = DateFormat.custom)
    private Date createTime;

    /**
     * 驳回原因
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String reason;

    private static final long serialVersionUID = 1L;
}
